package com.swj.common.core.remoteService;

import com.swj.common.core.model.SysLoginLog;
import com.swj.common.core.model.SysOperaLog;
import com.swj.common.core.constant.SecurityConstants;
import com.swj.common.core.remoteService.fallback.RemoteLogFallbackFactory;
import com.swj.common.core.model.web.RestResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(value ="wj-system",fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService {

    /**
     * 保存系统日志
     *
     * @param operLog 日志实体
     * @param source  请求来源
     * @return 结果
     */
    @PostMapping("/operlog/add")
    RestResult add(@RequestBody SysOperaLog operLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存访问记录
     *
     * @param sysLogininfor 访问实体
     * @param source        请求来源
     * @return 结果
     */
    @PostMapping("/loginLog/add")
    RestResult<Boolean> saveLogininfor(@RequestBody SysLoginLog sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
